package student;

import static org.junit.Assert.fail;

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class StudentDaoImplTest {

	StudentDao dao = new StudentDaoImpl();

	@Test
	public void testInsert() {
		assert dao.insert(new Student(11,"zs","1class",90)) : "error";
		assert dao.insert(new Student(12,"lisi","2class",60)) : "error";
		assert dao.insert(new Student(13,"wangwu","1class",80)) : "error";
		assert dao.insert(new Student(14,"maliu","2class",77)) : "error";
		assert dao.insert(new Student(15,"zhaoqi","1class",69)) : "error";
		assert dao.insert(new Student(16,"xiaoming","2class",84)) : "error";
	}

	@Test
	public void testDeleteById() {
		assert dao.deleteById(1) : "error";
	}

	@Test
	public void testUpdate() {
		assert dao.update(new Student(2,"zss","2class",88)) : "error";
	}

	@Test
	public void testSelectById() {
		System.out.println(dao.selectById(3));
	}

	@Test
	public void testSelectAll() {
		List<Student> all = dao.selectAll();
		all.forEach(System.out::println);
	}

	@Test
	public void testSelectByClass() {
		List<Student> all = dao.selectByClass("2class");
		all.forEach(System.out::println);
	}

	@Test
	public void testOrderByScoreDesc() {
		List<Student> all = dao.orderByScoreDesc();
		all.forEach(System.out::println);
	}
}
